<?php

require_once '../include.php';

$arr=$_POST;
$objectid=$_POST['objectid'];
// var_dump($arr);
// var_dump($objectid);

$PG = new pgsql("gis24.jlu3s.com", "23456", "ccly", "sde", "GIScontest2024");  
$PG->connect();
if(!$PG){  
    $db_error = "无法连接到PostGreSQL数据库！";  
    echo $db_error;   
}else{ 
    $q1 = "SELECT * FROM sde.sight where objectid='{$arr['objectid']}'";
    $r1 = $PG->query($q1); 
    // var_dump($r1);
    $r11 = $PG->affectedRows();
    // echo $r11;
    // var_dump($r11);
    if($r11>0){        
        $r = $PG->update("sde.sight", $arr,"objectid='{$objectid}'");
        if($r>0){            
            alertMes("修改成功！","sightList.php");       
        }else{
            alertMes("操作失败，请重试","sightList.php"); 
        }
    }
}